<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
    <div class="container-div">
		<div class="col-sm-12 select-info">
				<form id="post-form">
					<div class="select-list">
						<li>
							<label>餐别：</label>
							<select name="dinnerType" th:with="type=${@dict.getType('dinner_type')}">
								<option value="">全部餐别</option>
								<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
							</select>
						</li>
						<ul>
							<li class="select-time">
								<label>时间：</label>
								<input type="text" class="time-input" id="startTime" placeholder="开始时间" name="beginTime"/>
								<span>-</span>
								<input type="text" class="time-input" id="endTime" placeholder="结束时间" name="endTime"/>
							</li>
							<li>
								<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
								<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							    <a class="btn btn-success btn-rounded btn-sm" onclick="$.table.exportExcel()" shiro:hasPermission="statistic:bookDish:export"><i class="fa fa-download"></i>&nbsp;导出</a>
							</li>
						</ul>
					</div>
				</form>
			</div>
		<div class="col-sm-12 select-table table-striped">
			<table id="bootstrap-table" data-mobile-responsive="true"></table>
		</div>
    </div>
    <div th:include="include :: footer"></div>
    <script th:inline="javascript">
        var prefix = ctx + "/statistic/bookDish"

        $(function() {
            var options = {
                url: prefix + "/list",
                exportUrl: prefix + "/export",
                search: false,
		        showExport: false,
                modalName: "菜品统计",
                columns: [{
                    field : 'num',
                    align: "center",
                    title : '序号'
                },{
                    field : 'dishPic',
                    title : '照片' ,
                    width: '8%',
                    align: "center",
                    formatter: function(value) {
                        if(value != null && value!= ''){
                            return '<div class="wrapper"><img alt="" src="/profile/avatar/'+value+'"></div>';
                        }else{
                            return '<div class="wrapper"><img alt="" src="../img/nopic.png"></div>';
                        }
                    }
                },
				{
					field : 'dishName',
					title : '菜品名称'
				},
				{
					field : 'typeName',
					title : '菜品类型'
				},
				{
					field : 'several',
					title : '份数'
				}]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>